if ( !file.Exists( "../models/Vehicle.mdl" ) ) then return end // No EP2.

local completed = achievements.GetValue( "1.21 JIGAWATTS", "completed", 0 )

local target = 88
local tolerance = 3
local function CheckSpeed()
	if ( completed != 0 ) then return end
	
	local ply = LocalPlayer()
	if ( !ValidEntity( ply ) ) then return end
	
	local veh = ply:GetVehicle()
	if ( !ValidEntity( veh ) ) then return end
	
	if ( veh:GetClass() == "prop_vehicle_jeep" && string.lower( veh:GetModel() or "" ) == "models/vehicle.mdl" ) then
		local speed = veh:GetVelocity():Length() / 17.6
		if ( math.abs( speed - target ) <= tolerance ) then	
			achievements.Update( "1.21 JIGAWATTS", 1, "" )
			achievements.SetValue( "1.21 JIGAWATTS", "completed", 1 )
	
			completed = 1
		end
	end
end
timer.Create( "Achievements.Jigawatts", 0.25, 0, CheckSpeed )

achievements.Register( "1.21 JIGAWATTS", "Drive the Jalopy at 88mph.", "achievements/jigawatts", completed, "" )
